#!/bin/bash 

function do_day()
{
 date1=$1
 date2=$2
#verify dates 
 if ! date -d "$date1" 2>&1 > /dev/null ;  
 then echo "first date is invalid" ; exit 1 
 fi 
 if ! date -d "$date2" 2>&1 > /dev/null ;  
 then echo "second date is invalid" ; exit 1 
 fi 
#set current and end date 
 current=$(date -d "$date1" +%Y-%m-%d)
 end=$(date -d "$date2" +%Y-%m-%d)


echo "from $current to $end"
while [ "$end" != "$current" ]  
do 
	body $current
current=$(date -d "$current +1day" +%Y-%m-%d) 
done
}
